package com.aidysoft.practice.mybaties;

import com.aidysoft.practice.mybaties.pojo.User4;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.StringUtils;

/**
 * 〈〉
 */
public class SqlUtil {
    private final String TBL_ORDER = "t_user";
    public  String findByUsername1(User4 user4){
        SQL sql = new SQL().SELECT("*").FROM(TBL_ORDER);
        String username = user4.getUsername();
        if(!StringUtils.isEmpty(username)){
            sql.WHERE("username=#{username}");
        }
        sql.OR();
        String password = user4.getPassword();
        if(!StringUtils.isEmpty(password)){
            sql.WHERE("password=#{password}");
        }

        return sql.toString();
    }
}
